package org.jivesoftware.smackx.provider;

import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.provider.PacketExtensionProvider;
import org.jivesoftware.smackx.packet.MessageEvent;
import org.xmlpull.v1.XmlPullParser;

public class MessageEventProvider
  implements PacketExtensionProvider
{
  public PacketExtension parseExtension(XmlPullParser paramXmlPullParser)
    throws Exception
  {
    MessageEvent localMessageEvent = new MessageEvent();
    int i = 0;
    while (true)
    {
      int j;
      label133: 
      do
        while (true)
        {
          do
          {
            if (i != 0)
              return localMessageEvent;
            j = paramXmlPullParser.next();
            if (j != 2)
              break label133;
            if (paramXmlPullParser.getName().equals("id"))
              localMessageEvent.setPacketID(paramXmlPullParser.nextText());
            if (paramXmlPullParser.getName().equals("composing"))
              localMessageEvent.setComposing(true);
            if (paramXmlPullParser.getName().equals("delivered"))
              localMessageEvent.setDelivered(true);
            if (paramXmlPullParser.getName().equals("displayed"))
              localMessageEvent.setDisplayed(true);
          }
          while (!(paramXmlPullParser.getName().equals("offline")));
          localMessageEvent.setOffline(true);
        }
      while ((j != 3) || (!(paramXmlPullParser.getName().equals("x"))));
      i = 1;
    }
  }
}